var READY_STATE_UNINITIALIZED=0;
var READY_STATE_LOADING=1;
var READY_STATE_LOADED=2;
var READY_STATE_INTERACTIVE=3;
var READY_STATE_COMPLETE=4;

var http_request;

function cargaContenido(url, metodo, funcion) {
	http_request = inicializa_xhr();
	if(http_request) {
		http_request.onreadystatechange = funcion;
		http_request.open(metodo, url, true);
		http_request.send(null);
	}
}

function inicializa_xhr() {
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		return new XMLHttpRequest();
	}
	else if (window.ActiveXObject) { // Internet Explorer
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function muestraMensaje() {
//	alert(http_request);
	if(http_request.readyState == READY_STATE_COMPLETE) {
		if (http_request.status == 200) {
			alert(http_request.responseText);
		}
	}
}

function muestraContenidos() {
	alert(location.href);
	cargaContenido("http://localhost:8080/RefreshCounter/RefreshServlet", "GET", muestraMensaje);
}

function openDialogEdit(id){
	alert("edit "+id);
	muestraContenidos();
}
function delet(id){
	alert("eliminado "+id);
}